extends 基础弹窗类

@onready var title = %title

func _ready():
	var close_button = $MarginContainer/MarginContainer2/VBoxContainer/MarginContainer/Button
	close_button.pressed.connect(关闭)

func set_text(txt: String):
	var txt_label = $MarginContainer/MarginContainer2/VBoxContainer/HBoxContainer/Label
	txt_label.set_text(txt)

func _初始化(_data):
	set_text(data.message)
	if data.type=="normal":
		title.text="北京新闻"
	else:
		title.text="北京日记"
	if data.has("sound"):
		play_sound(_data.sound)

func play_sound(sound_name: String):
	var sound = load("res://resource/sound/" + sound_name)
	$AudioStreamPlayer.stream = sound
	$AudioStreamPlayer.play()
